unit UIntegerEditorFrame;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UTextEditorFrame, StdCtrls;

type
  TIntegerEditFrame = class(TTextEditFrame)
    procedure edValueChange(Sender: TObject);
  private
    FData: integer;
  protected
    function GetData: string; override;
    procedure SetData(const Value: string); override;
  public
    procedure AfterConstruction; override;
  end;

var
  IntegerEditFrame: TIntegerEditFrame;

implementation

{$R *.dfm}

procedure TIntegerEditFrame.AfterConstruction;
begin
  inherited;
  Data := '0';
end;

procedure TIntegerEditFrame.edValueChange(Sender: TObject);
begin
  Data := edValue.Text;
  edValue.Text := Data;
end;

function TIntegerEditFrame.GetData: string;
begin
  Result := IntToStr(FData);
end;

procedure TIntegerEditFrame.SetData(const Value: string);
var
  a, e: integer;
begin
  Val(Value, a, e);
  if e <> 0 then
    Exit;
  FData := a;
  inherited;
end;

end.
